/*
 * Created on 12.11.2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.nsu.konus.control;

import org.eclipse.core.runtime.Preferences;

/**
 * @author Dragon
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class KonusParameters implements IKonusParameters{
	
	private Preferences prefs;
	
	private static final String PACKAGE_NAME = ""; 
	
	private static final String KONUS_PATH = PACKAGE_NAME + "konusPath";
	
	private static final String RUSSIFIER_PATH = PACKAGE_NAME + "russifierPath";
	
	private static final String DOSBOX_PATH = PACKAGE_NAME + "dosboxPath";
	
	private static final String SOLVER_WORKING_TIME = PACKAGE_NAME + "workingTime";
	
	private static final String PARAMETRERS_DATA_NAME = PACKAGE_NAME + "parametersDataName";
	
	private static final String FORTRAN_SOURCE_NAME = PACKAGE_NAME + "fortranSourceName";
	
	private static final String SOLVER_NAME = PACKAGE_NAME + "solverName";
	
	private static final String RESULT_FILE_NAME = PACKAGE_NAME + "resultFileName";
	
	private static final String FORTRAN_PATH = PACKAGE_NAME + "fortranPath";
	
	private static final String USE_DEFAULT = PACKAGE_NAME + "useDefault";
	
	public KonusParameters(){
		prefs = new Preferences();
	}

	public KonusParameters(Preferences prefs){
		this.prefs = prefs;
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getKonusPath()
	 */
	public String getKonusPath() {
		return prefs.getString(KONUS_PATH);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getRussifierPath()
	 */
	public String getRussifierPath() {
		return prefs.getString(RUSSIFIER_PATH);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getDosboxPath()
	 */
	public String getDosboxPath() {
		return prefs.getString(DOSBOX_PATH);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#solverWorkingTime()
	 */
	public int getSolverWorkingTime() {
		return prefs.getInt(SOLVER_WORKING_TIME);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getParametersDataName()
	 */
	public String getParametersDataName() {
		return prefs.getString(PARAMETRERS_DATA_NAME);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getFortranSourceName()
	 */
	public String getFortranSourceName() {
		return prefs.getString(FORTRAN_SOURCE_NAME);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getSolverName()
	 */
	public String getSolverName() {
		return prefs.getString(SOLVER_NAME);
	}

	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getFortranPath()
	 */
	public String getFortranPath() {
		return prefs.getString(FORTRAN_PATH);
	}
	
	public boolean isUseDefault() {
		return prefs.getBoolean(USE_DEFAULT);
	}
	
	/* (non-Javadoc)
	 * @see com.nsu.konus.control.IKonusParameters#getResultFileName()
	 */
	public String getResultFileName() {
		return prefs.getString(RESULT_FILE_NAME);
	}
	
	public void setKonusPath(String konusPath) {
		prefs.setValue(KONUS_PATH, konusPath);
	}

	public void setRussifierPath(String russifierPath) {
		prefs.setValue(RUSSIFIER_PATH, russifierPath);
	}

	public void setDosboxPath(String dosboxPath) {
		prefs.setValue(DOSBOX_PATH, dosboxPath);
	}

	public void setSolverWorkingTime(int solverWorkingTime) {
		prefs.setValue(SOLVER_WORKING_TIME, solverWorkingTime);
	}

	public void setParametersDataName(String parametersDataName) {
		prefs.setValue(PARAMETRERS_DATA_NAME, parametersDataName);
	}

	public void setFortranSourceName(String fortranSourceName) {
		prefs.setValue(FORTRAN_SOURCE_NAME, fortranSourceName);
	}

	public void setSolverName(String solverName) {
		prefs.setValue(SOLVER_NAME, solverName);
	}

	public void setResultFileName(String resultFileName) {
		prefs.setValue(RESULT_FILE_NAME, resultFileName);
	}

	public void setFortranPath(String fortranPath) {
		prefs.setValue(FORTRAN_PATH, fortranPath);
	}
	
	public void setUseDefault(boolean useDefault) {
		prefs.setValue(USE_DEFAULT, useDefault);
	}
	
	public void setValue(String name, int value) {
		prefs.setValue(PACKAGE_NAME + name, value);
	}
	
	public void setValue(String name, String value) {
		prefs.setValue(PACKAGE_NAME + name, value);
	}
	
}
